package com.offcn.Dao;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.offcn.bean.UserBean;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

public class UserDao {
    //进行数据库中数据判断
    QueryRunner qr = new QueryRunner(new ComboPooledDataSource());
    public UserBean login(String username, String password){
        String sql ="select * from login where username=? and password=?";
        try {
            return qr.query(sql,new BeanHandler<UserBean>(UserBean.class),username,password);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

}
